home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: A Fancier ListBox ?
- Sent: 9/10/96 12:18 PM
- Received: 9/10/96 12:18 PM
- From: mlanett@meer.net (Mark Lanett)
- Reply-To: ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List
-
-
- >I have a need for a gadget that I can use to present a list of selections from
- >which one, or more, can be selected and then dragged out. The FW_CListBox is
- >a simple wrapper to the Mac List Manager and doesn't not have this
- >functionality (not does it have some other little things I want, like allowing
- >me to show an icon beside the text, for example) so I am wondering what my
- >best next step should be.
-
- You have two problems. One is that any work you do to FW_CListBox will be
- mac-specific and won't solve your Windows issue when R3 is released (and
- FW_CListBox wraps the Windows list box as well). Secondly, views can't do
- their own drag & drop; drag & drop only works at the frame level.
-
- The first problem would be solved by writing a "table view" in C++, to ODF,
- which will work anywhere ODF is ported.
-
- The second problem is solved either by embedding a different part (some
- sort of list part), or embedding one of your frames inside of itself, and
- then sticking the view in there. This will also solve the problem that
- non-platform-scrolling is limited to one view per frame. Alas we don't have
- any examples of how to do this, and it's really important, but it was
- discussed on the list earlier. Perhaps if Eudora's search function was less
- worthless I could even find it. <thrash thrash thrash> Ok, found it. See
- end of message.
-
- We do have an unsupported table view class which was supposed to show up in
- the tool chest (http://www.devtools.apple.com/frameworks/odf/contrib/); I'm
- not sure why it isn't there.
-
- Incidentally, while it would not be difficult to enhance FW_CListBox, we
- consider it undesirable to make functionality rely on features of platform
- controls which may not be available elsewhere. Likewise, drag & drop isn't
- available at the view level because views are intended to be more
- lightweight than frames, which can already do this.
-
- ---------------------
-
- Date: Thu, 13 Jun 1996 18:09:00 -0700
- Reply-To: ODF-Interest@CILabs.ORG
- Sender: owner-ODF-Interest@CILabs.ORG
- Precedence: list
- From: "Damon Cokenias" <cokenias@mtn-palace.com>
- To: OpenDoc Development Framework Discussion List <ODF-Interest@CILabs.ORG>
- Subject: Re: How to embed a part into yourself (long)
- Mime-Version: 1.0
- X-To: ODF-Interest@CILabs.ORG, fireboy@io.com
- X-Sender: mtn-3@SantaCruz01.pop.internex.net
-
- >Can someone point me to sample code or a routine that shows how to create a
- >part at run-time and embed in another part. For example, in response to the
- >user choosing the text tool from a palette and dragging a rectangle, create
- >a text part and embed it at the location the user specified.
-
- Mark, I meant to put together a little note about this just last week but
- forgot. Sorry.
-
- I've done this in one of our internal parts here at Apple. There are a few
- steps, none too difficult.
-
- First, create an ODShape to be used as the frame shape. Remember that the
- top-left corner of a frame shape should be {0,0} regardless of where the
- part will appear in your content. (More on location later).
-
-
- FW_CAcquiredODShape frameShape = FW_NewODShape (ev, bounds);
-
- Second, you need to obtain a reference to your document's draft and ask the
- draft to create a new ODPart. Given an FW_CPart, the following code will
- work:
-
- ODStorageUnit* su = myPart -> GetStorageUnit (ev);
- ODDraft* draft = su -> GetDraft (ev);
- FW_CAcquiredODPart newPart = draft ->
- CreatePart (ev, kTextKind, kODNoEditor);
-
- Note that in the above code, kTextKind would be the full ISO string
- describing the kind of data to be embedded. kODNoEditor signifies that
- OpenDoc should feel free to choose which editor to use for the embedded
- data. Instead, this parameter could be an ISO string for a particular
- editor.
-
- Third, you need to construct a proxy object to represent the embedded part
- within yor content model. See ODFEmbed and ODFDraw for examples of proxy
- objects. Depending on your content model you may need a very simple or
- very complicated proxy object.
-
- CMyProxy* myProxy = new CMyProxy (ev, myPart,
- myPart -> GetMainPresentation ());
-
- Finally, embed the newly created part in your content:
-
- myPart -> GetMainPresentation () -> Embed (ev, newPart, NULL,
- kODFrameObject,
- myProxy, frameShape, FW_CPart::gViewAsFrameToken,
- NULL, 0,
- FALSE, FALSE);
-
- These many parameters could use some explaining:
-
- ev That obnoxious SOM thing that almost every function
- takes as a
- parameter
- newPart The ODPart created by our document's draft
- NULL The ODFrame to embed. In our case, we want a frame
- created for
- us.
- kODFrameObject Suggested frame type.
- myProxy The subclass of FW_MProxy that will represent the
- embedded
- content.
- frameShape The frame shape, with its origin at {0,0}
- gViewAsFrameToken A tokenized ISO string describing how to embed the
- part. (As
- icon, thumbnail, frame, etc.)
- NULL Presentation type. NULL for default.
- 0 Frame group ID.
- FALSE Is overlaid
- FALSE Is subframe
-
-
-
-
- Once the above steps have been taken, the containing frame's
- CreateEmbeddedFacet method will be called. This is where you decide where
- to position the embedded content and how much of it to display.
-
- Often you will simply want a facet that is the same size and shape as the
- frame shape, just at a particular location in your frame. The code below
- positions the embedded part at {40,100}.
-
- ODFacet* CMyFrame::CreateEmbeddedFacet (Environment* ev, ODFacet*
- embeddingFacet,
- FW_MProxy* proxy, ODFrame* embeddedFrame,
- ODShape* proposedClipShape) {
-
- FW_CAcquiredODTransform externalTransform;
-
- externalTransform = ::FW_NewODTransform (ev, FW_CPoint
- (FW_IntToFixed (40),
- FW_IntToFixed (100)));
-
-
- return embeddeingFacet -> CreateEmbeddedFacet (ev, embeddedFrame,
- proposedClipShape, externalTransform, NULL, NULL, NULL,
- kODFrameInFront);
- }
-
- Once again, a quick breakdown of the parameters. First, the values passed
- to CreateEmbeddedFacet:
-
- ev Your favorite and mine.
- embeddingFacet The containing facet.
- proxy Your subclass of FW_MProxy that was passed to
- FW_CEmbeddingPresentation::Embed in the code above.
- embeddedFrame The frame of the embedded part that will draw in the facet
- you create.
- proposedClipShape This shape describes the shape of the facet that
- the embedded
- part would prefer to use. It is at {0,0}.
-
-
- The parameters to CreateEmbeddedFacet:
-
- ev How much time gets spent passing this parameter anyway?
- embeddedFrame The embedded frame
- proposedClipShape The (in this case unaltered) shape to use. If you
- want to use
- a shape other than the proposed shape, you should create
- another shape object, not mess with the
- proposedClipShape
- directly.
- externalTransform Where in the parent facet (your part's facet) the
- embedded
- facet should appear.
- NULL The canvas. NULL means use same canvas as
- containing part.
- NULL The biasCanvas. NULL because we are not using any funky
- drawing coordinates.
- NULL A sibling facet. If there is already a facet for this
- embedded frame, pass it here.
- kODFrameInFront Where the facet should be in relation to its
- sibling. This
- does not really apply in this situation because
- there is only
- one facet for this frame.
-
-
-
- Whew!
-
-
-
-
- If you remove all of my comments and maybe fix a spelling error or two,
- you'll probably be able to compile the above directly in to your part.
-
- I hope this was of help!
-
- -Damon
- Quality ODF Guy
-
-
- +-----------------------------------------------------------------------+
- | /\ Damon Cokenias |
- | /^^\ cokenias@mtn-palace.com |
- | /____\ Visit the Mountain Palace at http://www.netgate.net/~cokenias |
- +-----------------------------------------------------------------------+
-
- --
- Mark Lanett <mlanett@meer.net>
- Have a bajillion brilliant Jobsian lithium licks